package model;
// default package

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Tgood entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tgood", catalog = "test", uniqueConstraints = @UniqueConstraint(columnNames = "code"))
public class Tgood implements java.io.Serializable {

	// Fields

	private String id;
	private Tgoodtypes tgoodtypes;
	private String code;
	private String name;
	private String unit;
	private Double price;
	private Double cost;
	private String info;
	private Set<Tshoplist> tshoplists = new HashSet<Tshoplist>(0);
	private Set<Tinventory> tinventories = new HashSet<Tinventory>(0);

	// Constructors

	/** default constructor */
	public Tgood() {
	}

	/** minimal constructor */
	public Tgood(String id) {
		this.id = id;
	}

	/** full constructor */
	public Tgood(String id, Tgoodtypes tgoodtypes, String code, String name, String unit, Double price, Double cost, String info, Set<Tshoplist> tshoplists, Set<Tinventory> tinventories) {
		this.id = id;
		this.tgoodtypes = tgoodtypes;
		this.code = code;
		this.name = name;
		this.unit = unit;
		this.price = price;
		this.cost = cost;
		this.info = info;
		this.tshoplists = tshoplists;
		this.tinventories = tinventories;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "type")
	public Tgoodtypes getTgoodtypes() {
		return this.tgoodtypes;
	}

	public void setTgoodtypes(Tgoodtypes tgoodtypes) {
		this.tgoodtypes = tgoodtypes;
	}

	@Column(name = "code", unique = true)
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "unit")
	public String getUnit() {
		return this.unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	@Column(name = "price", precision = 100, scale = 3)
	public Double getPrice() {
		return this.price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@Column(name = "cost", precision = 100, scale = 3)
	public Double getCost() {
		return this.cost;
	}

	public void setCost(Double cost) {
		this.cost = cost;
	}

	@Column(name = "info")
	public String getInfo() {
		return this.info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tgood")
	public Set<Tshoplist> getTshoplists() {
		return this.tshoplists;
	}

	public void setTshoplists(Set<Tshoplist> tshoplists) {
		this.tshoplists = tshoplists;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tgood")
	public Set<Tinventory> getTinventories() {
		return this.tinventories;
	}

	public void setTinventories(Set<Tinventory> tinventories) {
		this.tinventories = tinventories;
	}

}